package osmparser;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.MultiLineString;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.io.WKBWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * 
 * @author Willy Tiengo
 */
public class OSMRelation extends AbstractNode {
	private List<AbstractNode> members; // list of abstract nodes
	private static final String type = "osmRelation";

	public OSMRelation(String id, String visible, String timestamp,
			String version, String changeset, String user, String uid,
			List<AbstractNode> members, Map<String, String> tags) {

		super(id, type, visible, timestamp, version, changeset, user, uid, tags);
		this.members = members;
	}

	public boolean isBoundary() {
		return tags.get("boundary") != null;
	}

	public int getAdminLevel() {
		return Integer.parseInt(tags.get("admin_level"));
	}

	public String getName() {
		return tags.get("name");
	}

	public List<AbstractNode> getMembers() {
		return members;
	}


//	public String getShape() {
//		Polygon pol = getPolygon();
//		return (pol != null) ? WKBWriter.bytesToHex(new WKBWriter().write(pol))
//				: null;
//	}

	public String toString() {
		return "<relation id=" + id + ">";
	}
}
